package helloWorld;


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * Example program to list links from a URL.
 */
public class ListLinks {
    public static void main(String[] args) throws IOException {
    	//Process process = new ProcessBuilder("/Volumes/E\\ Drive/node/phantomjs --ssl-protocol=any  /Volumes/E\\ Drive/node/hello.js").start();
    	Runtime runTime = Runtime.getRuntime();
    	Process process = runTime.exec("phantomjs --ssl-protocol=any /Volumes/E_Drive/node/hello.js");
    	try {
    		System.out.println("Executing");
			process.waitFor();
			System.out.println("Finishing");
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	InputStream is = process.getInputStream();
    	InputStreamReader isr = new InputStreamReader(is);
    	BufferedReader br = new BufferedReader(isr);
    	String line = " ";
    	while ((line = br.readLine()) != null) {
    	  System.out.println(line);
    	}

    }

}